# P174~P177
stringName = "我的名字叫做%s，请多多关照"
name = "小明"
print(stringName % name)

# 定义整数变量student_no，输出我的学号是000001
studentNumber = 1
print("我的学号是%06d" % studentNumber)

# 输出苹果单价9.00元/斤，购买了5.00斤，需要支付45.00元
price = 9.5
weight = 5
money = price * weight
printString = "苹果单价%.02f元/斤，购买了%.02f斤，需要支付%.02f元"
print(printString % (price, weight, money))

# 输出数据比例是25%
scale = 0.25
stringName = "数据比例是%.02f%%"
print(stringName % (scale * 100))

# 定义一个小数scale，输出数据比例是10.00%
stringName = "数据比例是%.02f%%"
scale = 10
print(stringName % scale)